1. Field of the Invention
Apparatuses and methods consistent with the present invention relate to reorganization of mapping information in a flash memory, and more particularly, to a fast reorganization in a flash memory, which can reduce a time spent for a mapping reorganization by reducing accesses needed to reorganize physical and logical sectors located in a flash memory when the flash memory is initialized.
2. Description of the Related Art
Digital devices such as digital cameras, mobile phones, personal digital assistants (PDAs) are now in widespread use.
The popularity of a flash memory as a storage device of the portable digital device is increasing due to its low-power, integrity, high-function, physical safety, and portability. Especially, as the capacity of the flash memory is enlarged, the flash memory is increasingly being used as a replacement for disk drives.
The flash memory performs an erase-before-write operation.
When a write operation is performed to a sector, the erase-before-write operation erases a block in which the sector belongs, and then performs a write operation.
Thus, the operation in the flash memory consumes more time for input/output operations than in a hard disk which can perform overlapping operations on the sector.
After performing approximately one hundred thousand erase operations, the block of the flash memory cannot perform further erase operations.
Accordingly, the erase operation shortens the life of the flash memory.
Due to this characteristic, when the write operation is performed in a specific sector of the flash memory, the flash memory searches for an empty area in the allocated block, or allocates a block that requires few erase operations in order to perform the write operation. The software to enable this characteristic is called the flash translation layer (FTL), which performs a function of mapping a logical sector address of the file system to a physical sector address of the flash memory.
An FTL algorithm minimizes the erase operation, and prevents the erase operation from being centralized to a single block.
Mapping used in the FTL algorithm is divided into sector mapping, block mapping, and hybrid mapping. The sector mapping maps a physical sector and logical sector by creating a mapping table having sector units. The block mapping maps a physical block and a logical block. The hybrid mapping uses the two aforementioned mapping methods, which can exploit the advantages of the two mapping methods.
The mapping table is mainly stored in the main memory of the system to be referred to in real-time, but it is also stored in the flash memory for the situation where the power is lost.
FIGS. 1A through 1C depict a relation of pages, blocks, and units that exist in a flash memory device.
A unit is a logical concept used in the FTL. One physical unit 110 has a plurality of sequential physical blocks 120, and is divided into a metadata-storage area 111 and a data-storage area 112.
The metadata-storage area 111 has a logical unit number 111a that is mapped to the physical unit 110, a depth 111b showing an age of the physical unit 110, and the number of erases 111c of the physical unit 110, as shown in FIG. 1B. For reference, the greater the number of the depth 111b is, the later the physical unit has been recorded.
The data-storage area 112 has data 112a and a logical sector number 112b that is mapped to a corresponding physical sector, as shown in FIG. 1C.
FIG. 2 depicts a mapping relation of a logical sector and a physical sector located in a related art physical unit.
In a physical unit 201 of a flash memory, physical sectors storing data 201a and information 201b on logical sectors mapped to the physical sectors are displayed.
A mapping table 202 stored in a main memory of a system displays logical sector numbers 202a and physical offset numbers 202b on the physical sectors mapped to the logical sectors.
The logical sector numbers 202a showing information on the physical sectors are displayed for convenience, but are not stored in the real mapping table since they may be displayed as indexes of the table.
When the flash memory is initialized, since the related art requires reading the physical sectors that belongs in each physical unit of the flash memory in order to organize mapping of the logical sectors and the physical sectors in each physical unit, it requires a long boot time, which causes performance deterioration of the system.